package com.helsinki.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.helsinki.mapper.SysLogMapper;
import com.helsinki.pojo.Product;
import com.helsinki.pojo.SysLog;
import com.helsinki.service.SysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysLogServiceImpl implements SysLogService {
    @Autowired
    private SysLogMapper sysLogMapper;

    @Override
    public void addLog(SysLog sysLog) {
        sysLogMapper.addLog(sysLog);
    }

    @Override
    public PageInfo<SysLog> queryAll(Integer pageNum, Integer pageSize) {
        // 只有在要分页的查询之前才能设置分页信息
        PageHelper.startPage(pageNum, pageSize);
        List<SysLog> list = sysLogMapper.findAll();
        // PageInfo 封装了所有的分页信息
        return new PageInfo<>(list);
    }
}
